package com.liukuan.netty.bio;

import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * Created by liukuan on 16/3/30.
 */
public class BioTimeServer {

	public static void main(String[] args) throws IOException {
		int port = 5678;
		String ip = InetAddress.getLocalHost().getHostAddress();
		ServerSocket ss = new ServerSocket(port);
		System.err.println("server is started at " + ip + ":" + port + ".");

		while (true) {
			try {
				Socket socket = ss.accept();
				new Thread(new GetTimeHandler(socket)).start();
			} catch (Exception e) {
				e.printStackTrace();
				break;
			}
		}

		ss.close();

	}

}
